package com.lyy.photovoltaic.controller;

import com.lyy.photovoltaic.common.vo.ResultVO;
import com.lyy.photovoltaic.service.UserEquipmentsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/usersEquipments")
@Api(value = "用户设备管理接口", tags = "用户设备管理")
public class UsersEquipmentsController {
    @Autowired
    UserEquipmentsService userEquipmentsService;
    @GetMapping(value = "/allUsersEquipments")
    //@ApiImplicitParam(dataType = "string", name = "token", value = "用户授权令牌", required = true)
    public ResultVO findAllEquipment() {
//        System.out.println("找到所有信息了");
        //查看所有设备信息
        ResultVO resultVO = userEquipmentsService.allUserEquipments();
        return resultVO;
    }
    @GetMapping(value = "/abnormalUserEquipments")
    //@ApiImplicitParam(dataType = "string", name = "token", value = "用户授权令牌", required = true)
    public ResultVO abnormalUserEquipments() {
//        System.out.println("找到所有信息了");
        //查看所有设备信息
        ResultVO resultVO = userEquipmentsService.abnormalUserEquipments();
        return resultVO;
    }
    @GetMapping(value = "/UserId/{uId}")
    @ApiImplicitParam(dataType = "string", name = "uId", value = "用户id", required = true)
    public ResultVO userEquipmentsByUeId(@PathVariable("uId") String uId) {
//        System.out.println(uId);
        //查看用户设备信息
        ResultVO resultVO = userEquipmentsService.userEquipmentsByUId(uId);
        return resultVO;
    }
}
